import dayjs from "dayjs"
import utc from "dayjs/plugin/utc"

dayjs.extend(utc)

export function formatUTC(
  utcString: string,
  format: string = "YYYY/MM/DD HH:mm:ss"
) {
  const resultTime = dayjs.utc(utcString).utcOffset(8).format(format)
  return resultTime
}

export function removeTime(pageInfo: any) {

  for (const key in pageInfo) {
      for(const item in pageInfo[key]){
        if (item === "createAt" || item === "updateAt") {
          // console.log("今天")
          pageInfo[key][item] =formatUTC(pageInfo[key][item])
        }
      }
  }
  // console.log(pageInfo)
  return pageInfo
}
